angular.module('moti.controllers.inspectorscreat', ['moti.services.regionsService', 'moti.services.inspectorsService', 'directiveModule', 'moti.directive.modal'])
    .controller('inspectorsCreatCtrl', ['$scope', '$location', 'RegionsInterface', 'InspectorsInterface', '$modal', function($scope, $location, RegionsInterface, InspectorsInterface, $modal){

        //获取景区列表
        RegionsInterface.getRegionsList().then(function(data){
            $scope.regions = data;
        });

        //提交
        $scope.inspectorsCreatForm = function(){
            if($scope.inspectors_creat_form.$valid){
                InspectorsInterface.postInspector($scope.inspector).then(function(data){
                    $modal({id : 'tip-modal', text : "添加检票员成功"}).show().autoHide();
                    $location.path('/inspectorsList');
                });
            }
        }
    }]);